import axios from './axios.tool'

import basicApi from '../api/Basicpath/index'

export default {
    getAll:(url,parms)=>{
       return new Promise((resolve, reject)=>{
            axios.get(`${basicApi}${url}`,parms).then((res)=>{
                resolve(res)
            })
       })
    },
    getSearch:(url,parms)=>{
        
        return new Promise((resolve, reject)=>{
            axios.get(`${basicApi}${url}`,parms).then((res)=>{
                resolve(res)
            })
       })
    },
    
    getTabChange:(url,parms)=>{
        if(parms.active == '2'){
            parms.isDelete = '0'
         }else if(parms.active == '3'){
            parms.isDelete = ''
         }else{
            parms.isDelete = parms.active
         }
         parms.currentPage =1
        return new Promise((resolve, reject)=>{
            axios.get(`${basicApi}${url}`,parms).then((res)=>{
                resolve(res)
            })
       })
    },
    getCurrentChange:(url,parms)=>{
        if(parms.active == '2'){
            parms.isDelete = '0'
         }else if(parms.active == '3'){
            parms.isDelete = null
         }else{
            parms.isDelete = parms.active
         }
         return new Promise((resolve, reject)=>{
            axios.get(`${basicApi}${url}`,parms).then((res)=>{
                resolve(res)
            })
       })
    },
    postAll:(url,parms)=>{
        return new Promise((resolve, reject)=>{
             axios.post(`${basicApi}${url}`,parms).then((res)=>{
                 resolve(res)
             })
        })
     },
}
